﻿/*
* 创建者：LIYINFAI
* 创建时间：2023/5/25 11:32:49
* 描述：
* --------------------------------------
* 修改说明：
* --------------------------------------
*/
using Newtonsoft.Json;
using System.ComponentModel;

namespace CommonLibrary
{
    /// <summary>
    /// COM通用配置信息（其他的仪器配置继承）
    /// </summary>
    public class ComParameter
    {
        /// <summary>
        /// 备注
        /// </summary>
        [Description("备注")]
        [JsonProperty(PropertyName = "remark")]
        public string Remark { get; set; } = string.Empty;
        /// <summary>
        /// 端口
        /// </summary>
        [Description("端口")]
        [JsonProperty(PropertyName = "portName")]
        public string PortName { get; set; } = string.Empty;
        /// <summary>
        /// 波特率
        /// </summary>
        [Description("波特率")]
        [JsonProperty(PropertyName = "baudRate")]
        public int BaudRate { get; set; } = 9600;
        /// <summary>
        /// 校验位
        /// </summary>
        [Description("校验位")]
        [JsonProperty(PropertyName = "parity")]
        public int Parity { get; set; } = 0;
        /// <summary>
        /// 数据位
        /// </summary>
        [Description("数据位")]
        [JsonProperty(PropertyName = "dataBits")]
        public int DataBits { get; set; } = 8;
        /// <summary>
        /// 停止位
        /// </summary>
        [Description("停止位")]
        [JsonProperty(PropertyName = "stopBits")]
        public int StopBits { get; set; } = 1;
        /// <summary>
        /// 状态地址
        /// </summary>
        [Description("状态地址")]
        [JsonProperty(PropertyName = "statusAddress")]
        public string StatusAddress { get; set; } = string.Empty;
        /// <summary>
        /// 描述信息
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return CommonHelper.GetObjectString(this);
        }
    }
    /// <summary>
    /// TCP通用配置信息（其他的仪器配置继承）
    /// </summary>
    public class TcpParameter
    {
        /// <summary>
        /// 状态地址
        /// </summary>
        [Description("状态地址")]
        [JsonProperty(PropertyName = "statusAddress")]
        public string StatusAddress { get; set; } = string.Empty;
        /// <summary>
        /// 备注
        /// </summary>
        [Description("备注")]
        [JsonProperty(PropertyName = "remark")]
        public string Remark { get; set; } = string.Empty;
        /// <summary>
        /// IP
        /// </summary>
        [Description("ServerIP")]
        [JsonProperty(PropertyName = "serverIP")]
        public string ServerIP { get; set; } = string.Empty;
        /// <summary>
        /// 端口号
        /// </summary>
        [Description("端口号")]
        [JsonProperty(PropertyName = "serverPort")]
        public int ServerPort { get; set; }
        /// <summary>
        /// 描述信息
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return CommonHelper.GetObjectString(this);
        }
    }
}
